<?php
namespace Common\Models;
use Common\BaseModel;
use Phalcon\Paginator\Adapter\Model as PaginatorModel;
class NoticesCate extends BaseModel
{
	public $res;
	public $expire;
    public function initialize()
    {
        parent::initialize();
        $this->setSource('f_notices_cate');
    }

    //获取公告栏目的ids
    public function getlistids(){
        $list = $this->find(array(
            'cloumns'=>'id',
        ))->toarray();
        if($list){
            $ids='';
            foreach($list as $key=>$value){
                $ids .=$value['id'].',';
            }
            $ids=substr($ids,0,strlen($ids)-1);
            return $ids;
        }else{
            return -2;
        }
    }


    /**
     * 获取推荐公告栏目
     */
    public function getlist($data=[]){
        $conditions='';
        if(isset($data['position'])){
            $conditions="position={$data['position']}";
        }
        $list = $this->find(array(
            $conditions,
            'cloumns'=>'id,name,icon',
        ))->toarray();
        return $list;
    }

}
